package com.example.mahjong.ui.widget;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.example.mahjong.R;
import com.example.mahjong.model.card.CNCard;
import com.example.mahjong.model.card.CNCardName;
import com.example.mahjong.model.card.Card;
import com.example.mahjong.tool.project.cache.CNCardCache;

import android.R.integer;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable.Orientation;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class BottomMahjongLineView extends LinearLayout{


	
	public BottomMahjongLineView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		layout = new LinearLayout(context);
		mContext = context;
		
		bottomMahjongViews = new ArrayList<Button>();
	}
	
	public void setMahjongsInfo(List<Card> cards){
		for(int i=0;i<cards.size();i++){
			//bottomMahjongViews.get(i).setBackground(background)
 			
			Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.gb_chupai_top_bottom);
			Bitmap firstBitmap = bitmap.createBitmap(bitmap, 0, 0, 20, bitmap.getHeight());
			Drawable bitmapDrawable = new BitmapDrawable(firstBitmap);
			ImageView imageView = new ImageView(mContext);
			imageView.setBackgroundDrawable(bitmapDrawable);
			addView(imageView);
		}
		
		Map<Integer, Drawable> cardMap = CNCardCache.getCache();
		ImageView imageView = new ImageView(mContext);
		imageView.setBackgroundDrawable(cardMap.get(CNCardName.THREETONG.ordinal()));
		addView(imageView);
		
		imageView = new ImageView(mContext);
		imageView.setBackgroundDrawable(cardMap.get(CNCardName.WEST.ordinal()));
		addView(imageView);
	}
	
	private List<Button> bottomMahjongViews;
	LinearLayout layout;
	Context mContext;
}
